﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using TouristAgencyDataLayer;

namespace TouristAgencyAsp
{
    public partial class Admin : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                this.reservationsRepeater.DataSource = Reservations.GetReservations();
                DataBind();
            }
        }

        protected void searchBtn_Click(object sender, EventArgs e)
        {
            var res = Reservations.GetReservations();
            if (this.resIdTxt.Text != "")
            {
                res = res.Where(r => r.ReservationId == Convert.ToInt32(this.resIdTxt.Text));
            }

            this.reservationsRepeater.DataSource = res;
            DataBind();
        }
    }
}